﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Data.UserDb;

namespace Acc_Web.controls
{
    public partial class CateItems : UserControl
    {
        public Int32 ServiceId
        {
            get {
                return ViewState[ID + "_serviceid"] == null
                           ? 0
                           : Convert.ToInt32(ViewState[ID + "_serviceid"]);
            }
            set { ViewState[ID + "_serviceid"] = value; }
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                var sr = new ShopRepository();
                _itemList.DataSource = sr.GetItemBySrvId(ServiceId).Take(8).ToArray();
                _itemList.DataBind();
            }
        }


    }
}